package com.wh.hotel.enums.strategy;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @author wenhao
 */
@Getter
@AllArgsConstructor
public enum TimeTypeEnum {
    ABSOLUTE_TIME(0, "绝对时间"),
    PRE_WEEK(1, "周期性-每周"),
    FOREVER(2, "永久生效"),
    ;

    private final int code;
    private final String desc;

    public static TimeTypeEnum parse(Integer code) {
        if (code == null) {
            return null;
        }
        for (TimeTypeEnum timeTypeEnum : TimeTypeEnum.values()) {
            if (timeTypeEnum.getCode() == code) {
                return timeTypeEnum;
            }
        }
        return null;
    }
}
